package com.yanqu.road.server.cmd.activity.dafuweng.zaoyao;

import com.yanqu.road.entity.activity.dafuweng.DFWConfig;
import com.yanqu.road.pb.monopoly.MonopolyProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.activity.ActivityMgr;
import com.yanqu.road.server.manger.activity.dafuweng.DaFuWengMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.GameProtocol;

import java.util.List;

@Cmd(code = GameProtocol.S_DA_FU_WENG_GET_ZAO_YAO_CARD_UNION_FROM_CROSS, desc = "跨服获取造谣卡商会列表返回")
public class GetZaoYaoCardUseUnionListFromCrossCmd extends AbstractCommand {

    int activityId;
    List<MonopolyProto.MonopolyUnionMsg> unionMsgListList;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        MonopolyProto.CrossGetZaoYaoCardCardUnionListRespMsg reqMsg = MonopolyProto.CrossGetZaoYaoCardCardUnionListRespMsg.parseFrom(packet.getBytes());
        activityId = reqMsg.getActivityId();
        unionMsgListList = reqMsg.getUnionMsgListList();
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        DFWConfig dfwConfig = DaFuWengMgr.getDfwConfig();
        if (dfwConfig == null || !ActivityMgr.activityInTime(dfwConfig.getActivityInfo())) {
            return;
        }
        if (dfwConfig.getActivityInfo().getActivityId() != activityId) {
            return;
        }

        DaFuWengMgr.GetZaoYaoCardUseUnionListFromCross(player, unionMsgListList);
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
